FROM sitregistry:5000/common/node:16 as build-stage
WORKDIR /app
COPY ./.yarnrc ./
COPY ./package.json ./
RUN yarn install --frozen-lockfile
#COPY ./yarn.lock ./
COPY ./ .
RUN npm run build

FROM sitregistry:5000/common/pateo-node:v1
WORKDIR /data
# RUN mkdir dist
COPY --from=build-stage /app/dist  ./dist
COPY nginx.conf /etc/nginx/
COPY cert.key /root/
COPY cert.crt /root/
RUN chmod -R 777 /data/dist

COPY ./startApp.sh /data/
RUN chmod 755 /data/startApp.sh
ENTRYPOINT ["/data/startApp.sh"]